\hypertarget{classTiXmlHandle}{\section{\-Ti\-Xml\-Handle \-Class \-Reference}
\label{classTiXmlHandle}\index{\-Ti\-Xml\-Handle@{\-Ti\-Xml\-Handle}}
}


{\ttfamily \#include $<$tinyxml.\-h$>$}

\subsection*{\-Public \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classTiXmlHandle_aba18fd7bdefb942ecdea4bf4b8e29ec8}{\hyperlink{classTiXmlHandle_aba18fd7bdefb942ecdea4bf4b8e29ec8}{\-Ti\-Xml\-Handle} (\hyperlink{classTiXmlNode}{\-Ti\-Xml\-Node} $\ast$\-\_\-node)}\label{classTiXmlHandle_aba18fd7bdefb942ecdea4bf4b8e29ec8}

\begin{DoxyCompactList}\small\item\em \-Create a handle from any node (at any depth of the tree.) \-This can be a null pointer. \end{DoxyCompactList}\item 
\hypertarget{classTiXmlHandle_a236d7855e1e56ccc7b980630c48c7fd7}{\hyperlink{classTiXmlHandle_a236d7855e1e56ccc7b980630c48c7fd7}{\-Ti\-Xml\-Handle} (const \hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} \&ref)}\label{classTiXmlHandle_a236d7855e1e56ccc7b980630c48c7fd7}

\begin{DoxyCompactList}\small\item\em \-Copy constructor. \end{DoxyCompactList}\item 
\hypertarget{classTiXmlHandle_ad8e5dcf6a87882674203157f29f8e4db}{\hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} {\bfseries operator=} (const \hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} \&ref)}\label{classTiXmlHandle_ad8e5dcf6a87882674203157f29f8e4db}

\item 
\hypertarget{classTiXmlHandle_acdb1faaf88a700b40ca2c8d9aee21139}{\hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} \hyperlink{classTiXmlHandle_acdb1faaf88a700b40ca2c8d9aee21139}{\-First\-Child} () const }\label{classTiXmlHandle_acdb1faaf88a700b40ca2c8d9aee21139}

\begin{DoxyCompactList}\small\item\em \-Return a handle to the first child node. \end{DoxyCompactList}\item 
\hypertarget{classTiXmlHandle_a8c61f64ae9365d89c264f289085541f8}{\hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} \hyperlink{classTiXmlHandle_a8c61f64ae9365d89c264f289085541f8}{\-First\-Child} (const char $\ast$value) const }\label{classTiXmlHandle_a8c61f64ae9365d89c264f289085541f8}

\begin{DoxyCompactList}\small\item\em \-Return a handle to the first child node with the given name. \end{DoxyCompactList}\item 
\hypertarget{classTiXmlHandle_a24d1112e995e937e4dddb202d4113d4a}{\hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} \hyperlink{classTiXmlHandle_a24d1112e995e937e4dddb202d4113d4a}{\-First\-Child\-Element} () const }\label{classTiXmlHandle_a24d1112e995e937e4dddb202d4113d4a}

\begin{DoxyCompactList}\small\item\em \-Return a handle to the first child element. \end{DoxyCompactList}\item 
\hypertarget{classTiXmlHandle_af0aea751320f5e430fac6f8fff3b8dd4}{\hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} \hyperlink{classTiXmlHandle_af0aea751320f5e430fac6f8fff3b8dd4}{\-First\-Child\-Element} (const char $\ast$value) const }\label{classTiXmlHandle_af0aea751320f5e430fac6f8fff3b8dd4}

\begin{DoxyCompactList}\small\item\em \-Return a handle to the first child element with the given name. \end{DoxyCompactList}\item 
\hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} \hyperlink{classTiXmlHandle_a072492b4be1acdb0db2d03cd8f71ccc4}{\-Child} (const char $\ast$value, int index) const 
\item 
\hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} \hyperlink{classTiXmlHandle_af9cf6a7d08a5da94a8924425ad0cd5ac}{\-Child} (int index) const 
\item 
\hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} \hyperlink{classTiXmlHandle_a979a3f850984a176ee884e394c7eed2d}{\-Child\-Element} (const char $\ast$value, int index) const 
\item 
\hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} \hyperlink{classTiXmlHandle_a8786475b9d1f1518492e3a46704c7ef0}{\-Child\-Element} (int index) const 
\item 
\hypertarget{classTiXmlHandle_a8b10982dd39e74f3b068ca8952282d8a}{\hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} {\bfseries \-First\-Child} (const std\-::string \&\-\_\-value) const }\label{classTiXmlHandle_a8b10982dd39e74f3b068ca8952282d8a}

\item 
\hypertarget{classTiXmlHandle_a743f1e9cc18b5658c158ed5c0c165354}{\hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} {\bfseries \-First\-Child\-Element} (const std\-::string \&\-\_\-value) const }\label{classTiXmlHandle_a743f1e9cc18b5658c158ed5c0c165354}

\item 
\hypertarget{classTiXmlHandle_a5c4617db96789e9a5581dd5c12cdd287}{\hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} {\bfseries \-Child} (const std\-::string \&\-\_\-value, int index) const }\label{classTiXmlHandle_a5c4617db96789e9a5581dd5c12cdd287}

\item 
\hypertarget{classTiXmlHandle_a2e5f7758156e6b29a8e7a423eca2cf5b}{\hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} {\bfseries \-Child\-Element} (const std\-::string \&\-\_\-value, int index) const }\label{classTiXmlHandle_a2e5f7758156e6b29a8e7a423eca2cf5b}

\item 
\hyperlink{classTiXmlNode}{\-Ti\-Xml\-Node} $\ast$ \hyperlink{classTiXmlHandle_af678e5088e83be67baf76f699756f2c3}{\-To\-Node} () const 
\item 
\hyperlink{classTiXmlElement}{\-Ti\-Xml\-Element} $\ast$ \hyperlink{classTiXmlHandle_abc6e7ed383a5fe1e52b0c0004b457b9e}{\-To\-Element} () const 
\item 
\hyperlink{classTiXmlText}{\-Ti\-Xml\-Text} $\ast$ \hyperlink{classTiXmlHandle_a4ac53a652296203a5b5e13854d923586}{\-To\-Text} () const 
\item 
\hyperlink{classTiXmlUnknown}{\-Ti\-Xml\-Unknown} $\ast$ \hyperlink{classTiXmlHandle_a1381c17507a130767b1e23afc93b3674}{\-To\-Unknown} () const 
\item 
\hyperlink{classTiXmlNode}{\-Ti\-Xml\-Node} $\ast$ \hyperlink{classTiXmlHandle_ab44b723a8dc9af72838a303c079d0376}{\-Node} () const 
\item 
\hyperlink{classTiXmlElement}{\-Ti\-Xml\-Element} $\ast$ \hyperlink{classTiXmlHandle_acb5fe8388a526289ea65e817a51e05e7}{\-Element} () const 
\item 
\hyperlink{classTiXmlText}{\-Ti\-Xml\-Text} $\ast$ \hyperlink{classTiXmlHandle_a9fc739c8a18d160006f82572fc143d13}{\-Text} () const 
\item 
\hyperlink{classTiXmlUnknown}{\-Ti\-Xml\-Unknown} $\ast$ \hyperlink{classTiXmlHandle_a49675b74357ba2aae124657a9a1ef465}{\-Unknown} () const 
\end{DoxyCompactItemize}


\subsection{\-Detailed \-Description}
\-A \hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} is a class that wraps a node pointer with null checks; this is an incredibly useful thing. \-Note that \hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} is not part of the \-Tiny\-Xml \-D\-O\-M structure. \-It is a separate utility class.

\-Take an example\-: \begin{DoxyVerb}
	<Document>
		<Element attributeA = "valueA">
			<Child attributeB = "value1" />
			<Child attributeB = "value2" />
		</Element>
	<Document>
	\end{DoxyVerb}


\-Assuming you want the value of \char`\"{}attribute\-B\char`\"{} in the 2nd \char`\"{}\-Child\char`\"{} element, it's very easy to write a $\ast$lot$\ast$ of code that looks like\-:

\begin{DoxyVerb}
	TiXmlElement* root = document.FirstChildElement( "Document" );
	if ( root )
	{
		TiXmlElement* element = root->FirstChildElement( "Element" );
		if ( element )
		{
			TiXmlElement* child = element->FirstChildElement( "Child" );
			if ( child )
			{
				TiXmlElement* child2 = child->NextSiblingElement( "Child" );
				if ( child2 )
				{
					// Finally do something useful.
	\end{DoxyVerb}


\-And that doesn't even cover \char`\"{}else\char`\"{} cases. \hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} addresses the verbosity of such code. \-A \hyperlink{classTiXmlHandle}{\-Ti\-Xml\-Handle} checks for null pointers so it is perfectly safe and correct to use\-:

\begin{DoxyVerb}
	TiXmlHandle docHandle( &document );
	TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement();
	if ( child2 )
	{
		// do something useful
	\end{DoxyVerb}


\-Which is \-M\-U\-C\-H more concise and useful.

\-It is also safe to copy handles -\/ internally they are nothing more than node pointers. \begin{DoxyVerb}
	TiXmlHandle handleCopy = handle;
	\end{DoxyVerb}


\-What they should not be used for is iteration\-:

\begin{DoxyVerb}
	int i=0; 
	while ( true )
	{
		TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement();
		if ( !child )
			break;
		// do something
		++i;
	}
	\end{DoxyVerb}


\-It seems reasonable, but it is in fact two embedded while loops. \-The \-Child method is a linear walk to find the element, so this code would iterate much more than it needs to. \-Instead, prefer\-:

\begin{DoxyVerb}
	TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement();

	for( child; child; child=child->NextSiblingElement() )
	{
		// do something
	}
	\end{DoxyVerb}
 

\subsection{\-Member \-Function \-Documentation}
\hypertarget{classTiXmlHandle_a072492b4be1acdb0db2d03cd8f71ccc4}{\index{\-Ti\-Xml\-Handle@{\-Ti\-Xml\-Handle}!\-Child@{\-Child}}
\index{\-Child@{\-Child}!TiXmlHandle@{\-Ti\-Xml\-Handle}}
\subsubsection[{\-Child}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Ti\-Xml\-Handle} {\bf \-Ti\-Xml\-Handle\-::\-Child} (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{value, }
\item[{int}]{index}
\end{DoxyParamCaption}
) const}}\label{classTiXmlHandle_a072492b4be1acdb0db2d03cd8f71ccc4}
\-Return a handle to the \char`\"{}index\char`\"{} child with the given name. \-The first child is 0, the second 1, etc. \hypertarget{classTiXmlHandle_af9cf6a7d08a5da94a8924425ad0cd5ac}{\index{\-Ti\-Xml\-Handle@{\-Ti\-Xml\-Handle}!\-Child@{\-Child}}
\index{\-Child@{\-Child}!TiXmlHandle@{\-Ti\-Xml\-Handle}}
\subsubsection[{\-Child}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Ti\-Xml\-Handle} {\bf \-Ti\-Xml\-Handle\-::\-Child} (
\begin{DoxyParamCaption}
\item[{int}]{index}
\end{DoxyParamCaption}
) const}}\label{classTiXmlHandle_af9cf6a7d08a5da94a8924425ad0cd5ac}
\-Return a handle to the \char`\"{}index\char`\"{} child. \-The first child is 0, the second 1, etc. \hypertarget{classTiXmlHandle_a979a3f850984a176ee884e394c7eed2d}{\index{\-Ti\-Xml\-Handle@{\-Ti\-Xml\-Handle}!\-Child\-Element@{\-Child\-Element}}
\index{\-Child\-Element@{\-Child\-Element}!TiXmlHandle@{\-Ti\-Xml\-Handle}}
\subsubsection[{\-Child\-Element}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Ti\-Xml\-Handle} {\bf \-Ti\-Xml\-Handle\-::\-Child\-Element} (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{value, }
\item[{int}]{index}
\end{DoxyParamCaption}
) const}}\label{classTiXmlHandle_a979a3f850984a176ee884e394c7eed2d}
\-Return a handle to the \char`\"{}index\char`\"{} child element with the given name. \-The first child element is 0, the second 1, etc. \-Note that only \-Ti\-Xml\-Elements are indexed\-: other types are not counted. \hypertarget{classTiXmlHandle_a8786475b9d1f1518492e3a46704c7ef0}{\index{\-Ti\-Xml\-Handle@{\-Ti\-Xml\-Handle}!\-Child\-Element@{\-Child\-Element}}
\index{\-Child\-Element@{\-Child\-Element}!TiXmlHandle@{\-Ti\-Xml\-Handle}}
\subsubsection[{\-Child\-Element}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Ti\-Xml\-Handle} {\bf \-Ti\-Xml\-Handle\-::\-Child\-Element} (
\begin{DoxyParamCaption}
\item[{int}]{index}
\end{DoxyParamCaption}
) const}}\label{classTiXmlHandle_a8786475b9d1f1518492e3a46704c7ef0}
\-Return a handle to the \char`\"{}index\char`\"{} child element. \-The first child element is 0, the second 1, etc. \-Note that only \-Ti\-Xml\-Elements are indexed\-: other types are not counted. \hypertarget{classTiXmlHandle_acb5fe8388a526289ea65e817a51e05e7}{\index{\-Ti\-Xml\-Handle@{\-Ti\-Xml\-Handle}!\-Element@{\-Element}}
\index{\-Element@{\-Element}!TiXmlHandle@{\-Ti\-Xml\-Handle}}
\subsubsection[{\-Element}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Ti\-Xml\-Element}$\ast$ {\bf \-Ti\-Xml\-Handle\-::\-Element} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTiXmlHandle_acb5fe8388a526289ea65e817a51e05e7}
\begin{DoxyRefDesc}{\-Deprecated}
\item[\hyperlink{deprecated__deprecated000002}{\-Deprecated}]use \-To\-Element. \-Return the handle as a \hyperlink{classTiXmlElement}{\-Ti\-Xml\-Element}. \-This may return null. \end{DoxyRefDesc}
\hypertarget{classTiXmlHandle_ab44b723a8dc9af72838a303c079d0376}{\index{\-Ti\-Xml\-Handle@{\-Ti\-Xml\-Handle}!\-Node@{\-Node}}
\index{\-Node@{\-Node}!TiXmlHandle@{\-Ti\-Xml\-Handle}}
\subsubsection[{\-Node}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Ti\-Xml\-Node}$\ast$ {\bf \-Ti\-Xml\-Handle\-::\-Node} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTiXmlHandle_ab44b723a8dc9af72838a303c079d0376}
\begin{DoxyRefDesc}{\-Deprecated}
\item[\hyperlink{deprecated__deprecated000001}{\-Deprecated}]use \-To\-Node. \-Return the handle as a \hyperlink{classTiXmlNode}{\-Ti\-Xml\-Node}. \-This may return null. \end{DoxyRefDesc}
\hypertarget{classTiXmlHandle_a9fc739c8a18d160006f82572fc143d13}{\index{\-Ti\-Xml\-Handle@{\-Ti\-Xml\-Handle}!\-Text@{\-Text}}
\index{\-Text@{\-Text}!TiXmlHandle@{\-Ti\-Xml\-Handle}}
\subsubsection[{\-Text}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Ti\-Xml\-Text}$\ast$ {\bf \-Ti\-Xml\-Handle\-::\-Text} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTiXmlHandle_a9fc739c8a18d160006f82572fc143d13}
\begin{DoxyRefDesc}{\-Deprecated}
\item[\hyperlink{deprecated__deprecated000003}{\-Deprecated}]use \hyperlink{classTiXmlHandle_a4ac53a652296203a5b5e13854d923586}{\-To\-Text()} \-Return the handle as a \hyperlink{classTiXmlText}{\-Ti\-Xml\-Text}. \-This may return null. \end{DoxyRefDesc}
\hypertarget{classTiXmlHandle_abc6e7ed383a5fe1e52b0c0004b457b9e}{\index{\-Ti\-Xml\-Handle@{\-Ti\-Xml\-Handle}!\-To\-Element@{\-To\-Element}}
\index{\-To\-Element@{\-To\-Element}!TiXmlHandle@{\-Ti\-Xml\-Handle}}
\subsubsection[{\-To\-Element}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Ti\-Xml\-Element}$\ast$ {\bf \-Ti\-Xml\-Handle\-::\-To\-Element} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTiXmlHandle_abc6e7ed383a5fe1e52b0c0004b457b9e}
\-Return the handle as a \hyperlink{classTiXmlElement}{\-Ti\-Xml\-Element}. \-This may return null. \hypertarget{classTiXmlHandle_af678e5088e83be67baf76f699756f2c3}{\index{\-Ti\-Xml\-Handle@{\-Ti\-Xml\-Handle}!\-To\-Node@{\-To\-Node}}
\index{\-To\-Node@{\-To\-Node}!TiXmlHandle@{\-Ti\-Xml\-Handle}}
\subsubsection[{\-To\-Node}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Ti\-Xml\-Node}$\ast$ {\bf \-Ti\-Xml\-Handle\-::\-To\-Node} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTiXmlHandle_af678e5088e83be67baf76f699756f2c3}
\-Return the handle as a \hyperlink{classTiXmlNode}{\-Ti\-Xml\-Node}. \-This may return null. \hypertarget{classTiXmlHandle_a4ac53a652296203a5b5e13854d923586}{\index{\-Ti\-Xml\-Handle@{\-Ti\-Xml\-Handle}!\-To\-Text@{\-To\-Text}}
\index{\-To\-Text@{\-To\-Text}!TiXmlHandle@{\-Ti\-Xml\-Handle}}
\subsubsection[{\-To\-Text}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Ti\-Xml\-Text}$\ast$ {\bf \-Ti\-Xml\-Handle\-::\-To\-Text} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTiXmlHandle_a4ac53a652296203a5b5e13854d923586}
\-Return the handle as a \hyperlink{classTiXmlText}{\-Ti\-Xml\-Text}. \-This may return null. \hypertarget{classTiXmlHandle_a1381c17507a130767b1e23afc93b3674}{\index{\-Ti\-Xml\-Handle@{\-Ti\-Xml\-Handle}!\-To\-Unknown@{\-To\-Unknown}}
\index{\-To\-Unknown@{\-To\-Unknown}!TiXmlHandle@{\-Ti\-Xml\-Handle}}
\subsubsection[{\-To\-Unknown}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Ti\-Xml\-Unknown}$\ast$ {\bf \-Ti\-Xml\-Handle\-::\-To\-Unknown} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTiXmlHandle_a1381c17507a130767b1e23afc93b3674}
\-Return the handle as a \hyperlink{classTiXmlUnknown}{\-Ti\-Xml\-Unknown}. \-This may return null. \hypertarget{classTiXmlHandle_a49675b74357ba2aae124657a9a1ef465}{\index{\-Ti\-Xml\-Handle@{\-Ti\-Xml\-Handle}!\-Unknown@{\-Unknown}}
\index{\-Unknown@{\-Unknown}!TiXmlHandle@{\-Ti\-Xml\-Handle}}
\subsubsection[{\-Unknown}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Ti\-Xml\-Unknown}$\ast$ {\bf \-Ti\-Xml\-Handle\-::\-Unknown} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTiXmlHandle_a49675b74357ba2aae124657a9a1ef465}
\begin{DoxyRefDesc}{\-Deprecated}
\item[\hyperlink{deprecated__deprecated000004}{\-Deprecated}]use \hyperlink{classTiXmlHandle_a1381c17507a130767b1e23afc93b3674}{\-To\-Unknown()} \-Return the handle as a \hyperlink{classTiXmlUnknown}{\-Ti\-Xml\-Unknown}. \-This may return null. \end{DoxyRefDesc}


\-The documentation for this class was generated from the following file\-:\begin{DoxyCompactItemize}
\item 
include/tinyxml.\-h\end{DoxyCompactItemize}
